<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class CreateO2oRefundPaymentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        if (!Schema::hasTable($prefix . 'o2o_refund_payment')) {
            Schema::create($prefix . 'o2o_refund_payment', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('refund_id');
                $table->integer('amount');  //金额
                $table->string('origin_type'); //退款类型：cash 现金；balance 余额；order 抵扣换货订单金额
                $table->integer('origin_id')->default(0);
                $table->timestamps();
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        $prefix = config('ibrand.app.database.prefix', 'ibrand_');
        
        Schema::drop($prefix . 'o2o_refund_payment');
    }
}
